{
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# Radius Neighbors Regressor"
      ],
      "metadata": {}
    },
    {
      "cell_type": "code",
      "source": [
        "import numpy as np\n",
        "import pandas as pd\n",
        "import matplotlib.pyplot as plt\n",
        "\n",
        "import warnings\n",
        "warnings.filterwarnings(\"ignore\")\n",
        "\n",
        "import yfinance as yf\n",
        "yf.pdr_override()"
      ],
      "outputs": [],
      "execution_count": 1,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:32.223Z",
          "iopub.execute_input": "2020-05-23T04:35:32.227Z",
          "iopub.status.idle": "2020-05-23T04:35:33.272Z",
          "shell.execute_reply": "2020-05-23T04:35:33.293Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# input\n",
        "symbol = 'AMD'\n",
        "start = '2014-01-01'\n",
        "end = '2018-08-27'\n",
        "\n",
        "# Read data \n",
        "dataset = yf.download(symbol,start,end)\n",
        "\n",
        "# Only keep close columns \n",
        "dataset.head()"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "[*********************100%***********************]  1 of 1 completed\n"
          ]
        },
        {
          "output_type": "execute_result",
          "execution_count": 2,
          "data": {
            "text/plain": [
              "            Adj Close  Close  High   Low  Open    Volume\n",
              "Date                                                    \n",
              "2014-01-02       3.95   3.95  3.98  3.84  3.85  20548400\n",
              "2014-01-03       4.00   4.00  4.00  3.88  3.98  22887200\n",
              "2014-01-06       4.13   4.13  4.18  3.99  4.01  42398300\n",
              "2014-01-07       4.18   4.18  4.25  4.11  4.19  42932100\n",
              "2014-01-08       4.18   4.18  4.26  4.14  4.23  30678700"
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Close</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Open</th>\n",
              "      <th>Volume</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>Date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2014-01-02</th>\n",
              "      <td>3.95</td>\n",
              "      <td>3.95</td>\n",
              "      <td>3.98</td>\n",
              "      <td>3.84</td>\n",
              "      <td>3.85</td>\n",
              "      <td>20548400</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-03</th>\n",
              "      <td>4.00</td>\n",
              "      <td>4.00</td>\n",
              "      <td>4.00</td>\n",
              "      <td>3.88</td>\n",
              "      <td>3.98</td>\n",
              "      <td>22887200</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-06</th>\n",
              "      <td>4.13</td>\n",
              "      <td>4.13</td>\n",
              "      <td>4.18</td>\n",
              "      <td>3.99</td>\n",
              "      <td>4.01</td>\n",
              "      <td>42398300</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-07</th>\n",
              "      <td>4.18</td>\n",
              "      <td>4.18</td>\n",
              "      <td>4.25</td>\n",
              "      <td>4.11</td>\n",
              "      <td>4.19</td>\n",
              "      <td>42932100</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2014-01-08</th>\n",
              "      <td>4.18</td>\n",
              "      <td>4.18</td>\n",
              "      <td>4.26</td>\n",
              "      <td>4.14</td>\n",
              "      <td>4.23</td>\n",
              "      <td>30678700</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 2,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:33.279Z",
          "iopub.execute_input": "2020-05-23T04:35:33.284Z",
          "iopub.status.idle": "2020-05-23T04:35:34.524Z",
          "shell.execute_reply": "2020-05-23T04:35:34.553Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "dataset['Increase_Decrease'] = np.where(dataset['Volume'].shift(-1) > dataset['Volume'],1,0)\n",
        "dataset['Buy_Sell_on_Open'] = np.where(dataset['Open'].shift(-1) > dataset['Open'],1,0)\n",
        "dataset['Buy_Sell'] = np.where(dataset['Adj Close'].shift(-1) > dataset['Adj Close'],1,0)\n",
        "dataset['Returns'] = dataset['Adj Close'].pct_change()\n",
        "dataset = dataset.dropna()"
      ],
      "outputs": [],
      "execution_count": 3,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:34.531Z",
          "iopub.execute_input": "2020-05-23T04:35:34.537Z",
          "shell.execute_reply": "2020-05-23T04:35:34.557Z",
          "iopub.status.idle": "2020-05-23T04:35:34.563Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "dataset.tail()"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 4,
          "data": {
            "text/plain": [
              "            Adj Close      Close   High        Low       Open     Volume  \\\n",
              "Date                                                                       \n",
              "2018-08-20  19.980000  19.980000  20.08  19.350000  19.790001   62983200   \n",
              "2018-08-21  20.400000  20.400000  20.42  19.860001  19.980000   55629000   \n",
              "2018-08-22  20.900000  20.900000  20.92  20.209999  20.280001   62002700   \n",
              "2018-08-23  22.290001  22.290001  22.32  21.139999  21.190001  113444100   \n",
              "2018-08-24  23.980000  23.980000  24.00  22.670000  22.910000  164328200   \n",
              "\n",
              "            Increase_Decrease  Buy_Sell_on_Open  Buy_Sell   Returns  \n",
              "Date                                                                 \n",
              "2018-08-20                  0                 1         1  0.010622  \n",
              "2018-08-21                  1                 1         1  0.021021  \n",
              "2018-08-22                  1                 1         1  0.024510  \n",
              "2018-08-23                  1                 1         1  0.066507  \n",
              "2018-08-24                  0                 0         0  0.075819  "
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Close</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Open</th>\n",
              "      <th>Volume</th>\n",
              "      <th>Increase_Decrease</th>\n",
              "      <th>Buy_Sell_on_Open</th>\n",
              "      <th>Buy_Sell</th>\n",
              "      <th>Returns</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>Date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2018-08-20</th>\n",
              "      <td>19.980000</td>\n",
              "      <td>19.980000</td>\n",
              "      <td>20.08</td>\n",
              "      <td>19.350000</td>\n",
              "      <td>19.790001</td>\n",
              "      <td>62983200</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.010622</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2018-08-21</th>\n",
              "      <td>20.400000</td>\n",
              "      <td>20.400000</td>\n",
              "      <td>20.42</td>\n",
              "      <td>19.860001</td>\n",
              "      <td>19.980000</td>\n",
              "      <td>55629000</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.021021</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2018-08-22</th>\n",
              "      <td>20.900000</td>\n",
              "      <td>20.900000</td>\n",
              "      <td>20.92</td>\n",
              "      <td>20.209999</td>\n",
              "      <td>20.280001</td>\n",
              "      <td>62002700</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.024510</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2018-08-23</th>\n",
              "      <td>22.290001</td>\n",
              "      <td>22.290001</td>\n",
              "      <td>22.32</td>\n",
              "      <td>21.139999</td>\n",
              "      <td>21.190001</td>\n",
              "      <td>113444100</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>1</td>\n",
              "      <td>0.066507</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2018-08-24</th>\n",
              "      <td>23.980000</td>\n",
              "      <td>23.980000</td>\n",
              "      <td>24.00</td>\n",
              "      <td>22.670000</td>\n",
              "      <td>22.910000</td>\n",
              "      <td>164328200</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0.075819</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 4,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:34.571Z",
          "iopub.execute_input": "2020-05-23T04:35:34.578Z",
          "iopub.status.idle": "2020-05-23T04:35:34.588Z",
          "shell.execute_reply": "2020-05-23T04:35:35.335Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "X = dataset.iloc[ : , 6:8].values\n",
        "y = dataset.iloc[ : , 8].values"
      ],
      "outputs": [],
      "execution_count": 5,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:34.595Z",
          "iopub.execute_input": "2020-05-23T04:35:34.599Z",
          "iopub.status.idle": "2020-05-23T04:35:34.607Z",
          "shell.execute_reply": "2020-05-23T04:35:35.339Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.model_selection import train_test_split  \n",
        "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20)  "
      ],
      "outputs": [],
      "execution_count": 6,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:34.616Z",
          "iopub.execute_input": "2020-05-23T04:35:34.622Z",
          "iopub.status.idle": "2020-05-23T04:35:35.165Z",
          "shell.execute_reply": "2020-05-23T04:35:35.342Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "print(X_train.shape)\n",
        "print(y_train.shape)\n",
        "print(X_test.shape)\n",
        "print(y_test.shape)"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "(936, 2)\n",
            "(936,)\n",
            "(234, 2)\n",
            "(234,)\n"
          ]
        }
      ],
      "execution_count": 7,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:35.175Z",
          "iopub.execute_input": "2020-05-23T04:35:35.180Z",
          "iopub.status.idle": "2020-05-23T04:35:35.195Z",
          "shell.execute_reply": "2020-05-23T04:35:35.345Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.neighbors import RadiusNeighborsRegressor\n",
        "from sklearn.neighbors import NearestNeighbors\n",
        "neigh = RadiusNeighborsRegressor(radius=1.0)\n",
        "neigh.fit(X_train, y_train)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 8,
          "data": {
            "text/plain": [
              "RadiusNeighborsRegressor(algorithm='auto', leaf_size=30, metric='minkowski',\n",
              "             metric_params=None, n_jobs=None, p=2, radius=1.0,\n",
              "             weights='uniform')"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 8,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:35.205Z",
          "iopub.execute_input": "2020-05-23T04:35:35.211Z",
          "iopub.status.idle": "2020-05-23T04:35:35.224Z",
          "shell.execute_reply": "2020-05-23T04:35:35.348Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "y_pred = neigh.predict(X_test)"
      ],
      "outputs": [],
      "execution_count": 9,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:35.234Z",
          "iopub.execute_input": "2020-05-23T04:35:35.240Z",
          "iopub.status.idle": "2020-05-23T04:35:35.251Z",
          "shell.execute_reply": "2020-05-23T04:35:35.782Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "y_test "
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 10,
          "data": {
            "text/plain": [
              "array([0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1,\n",
              "       0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1,\n",
              "       0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0,\n",
              "       0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0,\n",
              "       1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1,\n",
              "       0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0,\n",
              "       0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0,\n",
              "       0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1,\n",
              "       0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0,\n",
              "       1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0,\n",
              "       0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 10,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:35.262Z",
          "iopub.execute_input": "2020-05-23T04:35:35.267Z",
          "iopub.status.idle": "2020-05-23T04:35:35.278Z",
          "shell.execute_reply": "2020-05-23T04:35:35.787Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "y_pred"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 11,
          "data": {
            "text/plain": [
              "array([0.49853801, 0.49853801, 0.52522255, 0.49853801, 0.45554036,\n",
              "       0.45554036, 0.52294854, 0.45554036, 0.52522255, 0.52294854,\n",
              "       0.52294854, 0.49853801, 0.52294854, 0.52522255, 0.52294854,\n",
              "       0.45554036, 0.49853801, 0.49853801, 0.52294854, 0.49853801,\n",
              "       0.45554036, 0.49853801, 0.52294854, 0.45554036, 0.52294854,\n",
              "       0.52294854, 0.52294854, 0.49853801, 0.45554036, 0.45554036,\n",
              "       0.52522255, 0.45554036, 0.52294854, 0.45554036, 0.49853801,\n",
              "       0.45554036, 0.52294854, 0.45554036, 0.52522255, 0.45554036,\n",
              "       0.52522255, 0.52294854, 0.45554036, 0.52522255, 0.45554036,\n",
              "       0.49853801, 0.49853801, 0.45554036, 0.45554036, 0.49853801,\n",
              "       0.49853801, 0.45554036, 0.45554036, 0.52294854, 0.52522255,\n",
              "       0.45554036, 0.52294854, 0.49853801, 0.52294854, 0.52294854,\n",
              "       0.45554036, 0.52522255, 0.49853801, 0.52522255, 0.52522255,\n",
              "       0.45554036, 0.52522255, 0.52294854, 0.45554036, 0.49853801,\n",
              "       0.52294854, 0.52294854, 0.45554036, 0.52294854, 0.52294854,\n",
              "       0.52522255, 0.52294854, 0.52522255, 0.52294854, 0.45554036,\n",
              "       0.49853801, 0.52294854, 0.52294854, 0.52294854, 0.52522255,\n",
              "       0.52522255, 0.45554036, 0.45554036, 0.49853801, 0.52522255,\n",
              "       0.45554036, 0.49853801, 0.52522255, 0.52294854, 0.49853801,\n",
              "       0.52522255, 0.49853801, 0.45554036, 0.52522255, 0.49853801,\n",
              "       0.45554036, 0.52522255, 0.49853801, 0.45554036, 0.52294854,\n",
              "       0.52294854, 0.49853801, 0.52294854, 0.45554036, 0.52294854,\n",
              "       0.45554036, 0.49853801, 0.52522255, 0.52522255, 0.52294854,\n",
              "       0.52522255, 0.49853801, 0.52522255, 0.45554036, 0.49853801,\n",
              "       0.49853801, 0.52294854, 0.49853801, 0.45554036, 0.52522255,\n",
              "       0.49853801, 0.49853801, 0.45554036, 0.52294854, 0.52522255,\n",
              "       0.45554036, 0.52294854, 0.52294854, 0.52294854, 0.45554036,\n",
              "       0.45554036, 0.49853801, 0.52294854, 0.52294854, 0.49853801,\n",
              "       0.52522255, 0.52294854, 0.45554036, 0.52522255, 0.49853801,\n",
              "       0.52294854, 0.52522255, 0.52522255, 0.52294854, 0.49853801,\n",
              "       0.45554036, 0.45554036, 0.52522255, 0.52522255, 0.52522255,\n",
              "       0.49853801, 0.52522255, 0.49853801, 0.52522255, 0.49853801,\n",
              "       0.52522255, 0.45554036, 0.52294854, 0.52294854, 0.45554036,\n",
              "       0.49853801, 0.52522255, 0.52294854, 0.52294854, 0.49853801,\n",
              "       0.52294854, 0.52522255, 0.49853801, 0.45554036, 0.52294854,\n",
              "       0.52294854, 0.52294854, 0.52522255, 0.45554036, 0.52294854,\n",
              "       0.45554036, 0.45554036, 0.52294854, 0.49853801, 0.52522255,\n",
              "       0.52294854, 0.52294854, 0.49853801, 0.52522255, 0.52294854,\n",
              "       0.45554036, 0.45554036, 0.52294854, 0.49853801, 0.49853801,\n",
              "       0.52522255, 0.52522255, 0.45554036, 0.45554036, 0.45554036,\n",
              "       0.45554036, 0.49853801, 0.49853801, 0.49853801, 0.45554036,\n",
              "       0.49853801, 0.52522255, 0.45554036, 0.52522255, 0.45554036,\n",
              "       0.45554036, 0.52522255, 0.52294854, 0.49853801, 0.49853801,\n",
              "       0.52294854, 0.52522255, 0.49853801, 0.49853801, 0.49853801,\n",
              "       0.45554036, 0.52522255, 0.49853801, 0.52294854, 0.52522255,\n",
              "       0.49853801, 0.52294854, 0.52294854, 0.52294854, 0.49853801,\n",
              "       0.45554036, 0.49853801, 0.49853801, 0.52294854])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 11,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:35.286Z",
          "iopub.execute_input": "2020-05-23T04:35:35.291Z",
          "iopub.status.idle": "2020-05-23T04:35:35.300Z",
          "shell.execute_reply": "2020-05-23T04:35:35.790Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.neighbors import KNeighborsClassifier  \n",
        "\n",
        "error = []\n",
        "\n",
        "# Calculating error for K values between 1 and 40\n",
        "for i in range(1, 40):  \n",
        "    knn = KNeighborsClassifier(n_neighbors=i)\n",
        "    knn.fit(X_train, y_train)\n",
        "    pred_i = knn.predict(X_test)\n",
        "    error.append(np.mean(pred_i != y_test))"
      ],
      "outputs": [],
      "execution_count": 12,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:35.309Z",
          "iopub.execute_input": "2020-05-23T04:35:35.314Z",
          "iopub.status.idle": "2020-05-23T04:35:35.358Z",
          "shell.execute_reply": "2020-05-23T04:35:35.793Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "plt.figure(figsize=(12, 6))  \n",
        "plt.plot(range(1, 40), error, color='red', linestyle='dashed', marker='o',  \n",
        "         markerfacecolor='blue', markersize=10)\n",
        "plt.title('Error Rate K Value')  \n",
        "plt.xlabel('K Value')  \n",
        "plt.ylabel('Mean Error')  "
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 13,
          "data": {
            "text/plain": [
              "Text(0, 0.5, 'Mean Error')"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 864x432 with 1 Axes>"
            ],
            "image/png": [
              "iVBORw0KGgoAAAANSUhEUgAAAtoAAAGDCAYAAAAVh7eRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzs3Xl8VPW9//HXJyGsIQkxgMoqiG0VqdWoeK1Le9Xq7U/sYutS11u17i11r9aqtfe6a6nWVtFatZaq1ZZWELdaWilKvCqKVg3I5gpKAgRIIHx+f5yMGUKWmWTOnDkz7+fjMY9kzpzP93xmjPDJl+/5fM3dERERERGRzCqKOgERERERkXykQltEREREJAQqtEVEREREQqBCW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C+0PGjyehC0nLgK7bX1F1/I91oR0RERETUZZSnjkRERERE1CaNdkREREREDdJoR0RERETUII12REREREQN0mhHRERERNQgjXZERAtJOtSxvFrS85LO7BhbLGmvpLdMe96EpJ4XtJD0WUm31xN1RMRoSaMdEdFiki4BbqO6QtxLU+O29wAvAxd1bHs2cJLtHcc7zoiIUZRGOyKipSRdRHXJ70ttv9Blk3uoroA25fIyhqSPS9ouaaekX0ta2OX1N0m6rGO98yz6tZKelPSMpJuO1T5FRMwmabQjItrpBKpLBa+z/VyPbTYD6yTNLeufoboCGsBjwDLb55ax6wb9w5JWAkuAC6iuiHiepItnvgsREbPb3KNvEhERQ+h14LfABmBjtw1s/0nSs8Alkg4Ar9veVR4eA+6TdDowH3hxBn97ZbntLOsLqBrvbTPei4iIWSxntCMi2ukI8GngfEk39NluavrIf6aNFLcBt9t+P3A1cGKX5x6mHCckiaohBxDwTdvj5fZe23f+X3sTETELpdGOiGgp2/8A1gBXStrQY7P7gdW8cdoIwNuBfWV5fY/n7gHOK8trgXll+VfA5yQtAJC0SNJpb2YfIiJms0wdiYhoMduvSloFbJP0Z9tbpj1+UNITwELbndNDbgR+LGkf8ARwVpeXvwPYImkHsBX4e3nNByUtBR6vTnRzCLgKmDy2excR0W6y3XQMERERERGzTqaORERERETUII12REREREQN0mhHRERERNQgjXZERERERA3SaEdERERE1CCNdkREREREDdJoR0RERETUII12REREREQN/g0sX9LzM3iOrQAAAABJRU5ErkJggg==\n"
            ]
          },
          "metadata": {
            "needs_background": "light"
          }
        }
      ],
      "execution_count": 13,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:35.366Z",
          "iopub.execute_input": "2020-05-23T04:35:35.371Z",
          "iopub.status.idle": "2020-05-23T04:35:35.561Z",
          "shell.execute_reply": "2020-05-23T04:35:35.796Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.metrics import accuracy_score\n",
        "\n",
        "for K in range(40):\n",
        "    K_value = K+1\n",
        "    knn = KNeighborsClassifier(n_neighbors = K_value, weights='uniform', algorithm='auto')\n",
        "    knn.fit(X_train, y_train) \n",
        "    y_pred = knn.predict(X_test)\n",
        "    print(\"Accuracy is \", accuracy_score(y_test,y_pred)*100,\"% for K-Value:\",K_value)"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Accuracy is  50.427350427350426 % for K-Value: 1\n",
            "Accuracy is  50.427350427350426 % for K-Value: 2\n",
            "Accuracy is  48.717948717948715 % for K-Value: 3\n",
            "Accuracy is  48.717948717948715 % for K-Value: 4\n",
            "Accuracy is  47.863247863247864 % for K-Value: 5\n",
            "Accuracy is  48.717948717948715 % for K-Value: 6\n",
            "Accuracy is  48.717948717948715 % for K-Value: 7\n",
            "Accuracy is  48.717948717948715 % for K-Value: 8\n",
            "Accuracy is  48.717948717948715 % for K-Value: 9\n",
            "Accuracy is  48.717948717948715 % for K-Value: 10\n",
            "Accuracy is  48.717948717948715 % for K-Value: 11\n",
            "Accuracy is  48.717948717948715 % for K-Value: 12\n",
            "Accuracy is  48.717948717948715 % for K-Value: 13\n",
            "Accuracy is  48.717948717948715 % for K-Value: 14\n",
            "Accuracy is  55.55555555555556 % for K-Value: 15\n",
            "Accuracy is  55.55555555555556 % for K-Value: 16\n",
            "Accuracy is  55.55555555555556 % for K-Value: 17\n",
            "Accuracy is  48.717948717948715 % for K-Value: 18\n",
            "Accuracy is  54.700854700854705 % for K-Value: 19\n",
            "Accuracy is  55.55555555555556 % for K-Value: 20\n",
            "Accuracy is  54.700854700854705 % for K-Value: 21\n",
            "Accuracy is  54.700854700854705 % for K-Value: 22\n",
            "Accuracy is  54.700854700854705 % for K-Value: 23\n",
            "Accuracy is  54.700854700854705 % for K-Value: 24\n",
            "Accuracy is  54.700854700854705 % for K-Value: 25\n",
            "Accuracy is  54.700854700854705 % for K-Value: 26\n",
            "Accuracy is  54.700854700854705 % for K-Value: 27\n",
            "Accuracy is  54.700854700854705 % for K-Value: 28\n",
            "Accuracy is  54.700854700854705 % for K-Value: 29\n",
            "Accuracy is  54.700854700854705 % for K-Value: 30\n",
            "Accuracy is  54.700854700854705 % for K-Value: 31\n",
            "Accuracy is  54.700854700854705 % for K-Value: 32\n",
            "Accuracy is  54.700854700854705 % for K-Value: 33\n",
            "Accuracy is  54.700854700854705 % for K-Value: 34\n",
            "Accuracy is  54.700854700854705 % for K-Value: 35\n",
            "Accuracy is  54.700854700854705 % for K-Value: 36\n",
            "Accuracy is  54.700854700854705 % for K-Value: 37\n",
            "Accuracy is  54.700854700854705 % for K-Value: 38\n",
            "Accuracy is  54.700854700854705 % for K-Value: 39\n",
            "Accuracy is  55.55555555555556 % for K-Value: 40\n"
          ]
        }
      ],
      "execution_count": 14,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false,
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:35.569Z",
          "iopub.execute_input": "2020-05-23T04:35:35.574Z",
          "iopub.status.idle": "2020-05-23T04:35:35.718Z",
          "shell.execute_reply": "2020-05-23T04:35:35.798Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "neigh = NearestNeighbors(n_neighbors=2)\n",
        "neigh.fit(X)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 15,
          "data": {
            "text/plain": [
              "NearestNeighbors(algorithm='auto', leaf_size=30, metric='minkowski',\n",
              "         metric_params=None, n_jobs=None, n_neighbors=2, p=2, radius=1.0)"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 15,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:35.727Z",
          "iopub.execute_input": "2020-05-23T04:35:35.733Z",
          "iopub.status.idle": "2020-05-23T04:35:35.744Z",
          "shell.execute_reply": "2020-05-23T04:35:35.803Z"
        }
      }
    },
    {
      "cell_type": "code",
      "source": [
        "A = neigh.kneighbors_graph(X)\n",
        "A.toarray()"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 16,
          "data": {
            "text/plain": [
              "array([[1., 0., 0., ..., 0., 0., 0.],\n",
              "       [1., 0., 0., ..., 0., 0., 0.],\n",
              "       [0., 0., 0., ..., 0., 0., 0.],\n",
              "       ...,\n",
              "       [1., 0., 0., ..., 0., 0., 0.],\n",
              "       [1., 0., 0., ..., 0., 0., 0.],\n",
              "       [0., 0., 0., ..., 0., 0., 0.]])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 16,
      "metadata": {
        "collapsed": true,
        "outputExpanded": false,
        "jupyter": {
          "source_hidden": false,
          "outputs_hidden": false
        },
        "nteract": {
          "transient": {
            "deleting": false
          }
        },
        "execution": {
          "iopub.status.busy": "2020-05-23T04:35:35.750Z",
          "iopub.execute_input": "2020-05-23T04:35:35.755Z",
          "iopub.status.idle": "2020-05-23T04:35:35.766Z",
          "shell.execute_reply": "2020-05-23T04:35:35.807Z"
        }
      }
    }
  ],
  "metadata": {
    "kernel_info": {
      "name": "python3"
    },
    "language_info": {
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "version": "3.5.5",
      "file_extension": ".py",
      "pygments_lexer": "ipython3",
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      }
    },
    "kernelspec": {
      "name": "python3",
      "language": "python",
      "display_name": "Python 3"
    },
    "nteract": {
      "version": "0.23.1"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 4
}